package com.zhn.evsi.controller.Evsi;

import com.zhn.evsi.common.Result;
import com.zhn.evsi.domain.dto.evsi.counter.EvsiCounterDTO;
import com.zhn.evsi.domain.entity.evsi.EvsiCounter;
import com.zhn.evsi.service.IEvsiCounterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperationSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Arrays;
import java.util.List;

@Api(tags = "异常计数器")
@RestController
@RequestMapping("/Evsi/counter")
public class EvsiCounterController {

    @Autowired
    private IEvsiCounterService counterService;

    @ApiOperation("新增计数器")
    @ApiOperationSupport(order = 1)
    @GetMapping("/addCounter")
    public Result addCounter(@RequestParam String counterName) {
        counterService.addCounter(counterName);
        return Result.success();
    }

    @ApiOperation("修改计数器")
    @ApiOperationSupport(order = 1)
    @PostMapping("/editCounter")
    public Result editCounter(@RequestBody EvsiCounterDTO counterDTO) {
        counterService.editCounter(counterDTO);
        return Result.success();
    }

    @ApiOperation("查询计数器")
    @ApiOperationSupport(order = 2)
    @GetMapping("getCounter")
    public Result getCounter() {
        return Result.success(counterService.getCounter());
    }

    @ApiOperation("计数器步进")
    @ApiOperationSupport(order = 3)
    @PostMapping("/stepCounter")
    public Result stepCounter(@RequestBody EvsiCounterDTO counterDTO) {
        counterService.stepCounter(counterDTO);
        return Result.success();
    }

    @ApiOperation("计数器计划")
    @ApiOperationSupport(order = 4)
    @PostMapping("/planCounter")
    public Result planCounter(@RequestBody EvsiCounterDTO counterDTO) {
        counterService.planCounter(counterDTO);
        return Result.success();
    }

    @ApiOperation("计数器删除")
    @ApiOperationSupport(order = 5)
    @PostMapping("/delCounter")
    public Result delCounter(@RequestBody String[] ids) {
        counterService.delCounter(ids);
        return Result.success();
    }




}
